#include "BD_Sound.h"
#include "BD_SDLHeaders.h"

using namespace BnD;


BD_Sound::BD_Sound()
{
	m_music = new BD_Music();
}

BD_Sound::BD_Sound(const BD_Sound& sound)
{
	m_music = sound.m_music;
	++(m_music->m_refCount);
}

BD_Sound::BD_Sound(const string& fileName)
{
	m_music = new BD_Music(fileName);
}

BD_Sound::~BD_Sound()
{
	if(m_music != NULL && (--m_music->m_refCount != 0))
	{		
		delete m_music;
	}
}

BD_Sound& BD_Sound::operator = (const BD_Sound& sound)
{
	if(this != &sound)
	{
		m_music = sound.m_music;
		++(m_music->m_refCount);
	}
	return *this;
}